/**
 * 选择单个部门
 */
var zTree1 = null;
$(document).ready(function(){
	$("#dialogTree").height($(window).height());
	zTree1 = $.fn.zTree.init($("#treeDemo"), setting);
});
var setting = {
	async: {
		enable: true,
		url: base + "/admin/system/buyer/scopeTreeData.jhtml",
		autoParam: ["id=parentId"]
	},
	check: {
		enable: true,
		chkboxType:{ "Y": "ps", "N": "ps" }
	},
	data: {
		simpleData: {
			enable: true
		}
	},
	callback: {
	}
};

function toCheckNodes(checkedStr){
	var names = checkedStr.split(",");
	for(var i = 0;i < names.length;i++){
		var node = zTree1.getNodeByParam("name", names[i], null);
		zTree1.checkNode(node, true, true);
	}
}

function filter(node){
	return !node.isParent && node.checked;
}

function getCheckedNodes(){
	return zTree1.getNodesByFilter(filter); 
}